package com.xlh.dto.courseTest.experiment;

import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.math.BigDecimal;

/**
 * @author cfz
 */
@Data
@ApiModel(" 理论课章节统计导出ExcelDto ")
@Accessors(chain = true)
public class TheoryChapterStatisticsExportDTO {

    @ApiModelProperty("用户Id")
    private Long userId;

    @ApiModelProperty("序号")
    private Integer index;

    @ApiModelProperty(" 学生姓名 ")
    private String name;

    @ApiModelProperty(" 学号 ")
    private String userNumber;

    @ApiModelProperty("视频时长")
    private BigDecimal videoTime;

    @ApiModelProperty("学习时长")
    private BigDecimal learnTime;

    @ApiModelProperty("随堂练习分数")
    private Long score;

    @ApiModelProperty("优")
    private Long excellent;

    @ApiModelProperty("良")
    private Long good;

    @ApiModelProperty("差")
    private Long poor;

    @ApiModelProperty("正确")
    private Long correct;

    @ApiModelProperty("错误")
    private Long inCorrect;

    /**
     * 将学习时间更改为小时
     */
    public void setTimeToHours() {

        if(ObjectUtil.isNull(videoTime)){
            videoTime = new BigDecimal(0d);
        }
        if(ObjectUtil.isNull(learnTime)){
            learnTime = new BigDecimal(0d);
        }
        videoTime = NumberUtil.div(videoTime, 3600d,2);
        learnTime = NumberUtil.div(learnTime, 3600d, 2);
    }

    /**
     * 初始化参数
     */
    public void initProperty(){
        this.setLearnTime(BigDecimal.valueOf(0));
        this.setVideoTime(BigDecimal.valueOf(0));
        this.setScore(0L);
    }



}
